package com.yuexunit.operationman.nbsy.module.BeforeAnesthesiaVisit.ui;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


import com.yuexunit.operationman.nbsy.R;
import com.yuexunit.operationman.nbsy.base.BaseKJActivity;
import com.yuexunit.operationman.nbsy.config.AppConfig;
import com.yuexunit.operationman.nbsy.module.BeforeAnesthesiaVisit.ui.fragment.Fragment_BA_Anesthesia;
import com.yuexunit.operationman.nbsy.module.BeforeAnesthesiaVisit.ui.fragment.Fragment_BA_Evaluate;
import com.yuexunit.operationman.nbsy.module.BeforeAnesthesiaVisit.ui.fragment.Fragment_BA_Number;
import com.yuexunit.operationman.nbsy.module.BeforeAnesthesiaVisit.ui.fragment.Fragment_BA_Status;

import org.kymjs.kjframe.utils.PreferenceHelper;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by chenss on 2017/8/8 0008.
 */

public class Act_BeforeAnesthesiaPreview extends BaseKJActivity {

    @Bind(R.id.tv_patient_name)
    TextView tvPatientName;
    @Bind(R.id.tv_patient_sex)
    TextView tvPatientSex;
    @Bind(R.id.tv_patient_visitno)
    TextView tvPatientVisitno;
    @Bind(R.id.tv_patient_disease)
    TextView tvPatientDisease;
    @Bind(R.id.anesthesia_preview_img_01)
    ImageView anesthesiaPreviewImg01;
    @Bind(R.id.anesthesia_preview_img_02)
    ImageView anesthesiaPreviewImg02;
    @Bind(R.id.anesthesia_preview_img_03)
    ImageView anesthesiaPreviewImg03;
    @Bind(R.id.anesthesia_preview_img_04)
    ImageView anesthesiaPreviewImg04;

    Fragment_BA_Anesthesia fragmentBaAnesthesia;
    Fragment_BA_Evaluate fragmentBaEvaluate;
    Fragment_BA_Number fragmentBaNumber;
    Fragment_BA_Status fragmentBaStatus;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_beforeanesthesiapreview);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();
        fragmentBaAnesthesia = new Fragment_BA_Anesthesia();
        fragmentBaEvaluate = new Fragment_BA_Evaluate();
        fragmentBaNumber = new Fragment_BA_Number();
        fragmentBaStatus = new Fragment_BA_Status();

        changeFragment(R.id.content, fragmentBaStatus);
        setTitle();
    }

    private void setTitle() {
        tvPatientName.setText(AppConfig.BEFOREANSETHESIA.getObject().getVisit().getPatientName());
        if (AppConfig.BEFOREANSETHESIA.getObject().getVisit().getPatientSex().equals("1")) {
            tvPatientSex.setText("男");
        } else if (AppConfig.BEFOREANSETHESIA.getObject().getVisit().getPatientSex().equals("2")) {
            tvPatientSex.setText("女");
        } else {
            tvPatientSex.setText("不详");
        }
        tvPatientVisitno.setText("住院号" + AppConfig.BEFOREANSETHESIA.getObject().getVisit().getInHospitalNo());
        tvPatientDisease.setText(PreferenceHelper.readString(aty, AppConfig.PATIENT_INFO, AppConfig.PATIENT_DISEASE));
    }

    @OnClick({R.id.titlebar_docadvice_img_back, R.id.tv_submit, R.id.anesthesia_preview_ll_01,
            R.id.anesthesia_preview_ll_02, R.id.anesthesia_preview_ll_03, R.id.anesthesia_preview_ll_04})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.titlebar_docadvice_img_back:
                finish();
                break;
            case R.id.tv_submit:
                break;
            case R.id.anesthesia_preview_ll_01:
                anesthesiaPreviewImg01.setVisibility(View.VISIBLE);
                anesthesiaPreviewImg02.setVisibility(View.INVISIBLE);
                anesthesiaPreviewImg03.setVisibility(View.INVISIBLE);
                anesthesiaPreviewImg04.setVisibility(View.INVISIBLE);
                changeFragment(R.id.content, fragmentBaStatus);
                break;
            case R.id.anesthesia_preview_ll_02:
                anesthesiaPreviewImg01.setVisibility(View.INVISIBLE);
                anesthesiaPreviewImg02.setVisibility(View.VISIBLE);
                anesthesiaPreviewImg03.setVisibility(View.INVISIBLE);
                anesthesiaPreviewImg04.setVisibility(View.INVISIBLE);
                changeFragment(R.id.content, fragmentBaNumber);
                break;
            case R.id.anesthesia_preview_ll_03:
                anesthesiaPreviewImg01.setVisibility(View.INVISIBLE);
                anesthesiaPreviewImg02.setVisibility(View.INVISIBLE);
                anesthesiaPreviewImg03.setVisibility(View.VISIBLE);
                anesthesiaPreviewImg04.setVisibility(View.INVISIBLE);
                changeFragment(R.id.content, fragmentBaEvaluate);
                break;
            case R.id.anesthesia_preview_ll_04:
                anesthesiaPreviewImg01.setVisibility(View.INVISIBLE);
                anesthesiaPreviewImg02.setVisibility(View.INVISIBLE);
                anesthesiaPreviewImg03.setVisibility(View.INVISIBLE);
                anesthesiaPreviewImg04.setVisibility(View.VISIBLE);
                changeFragment(R.id.content, fragmentBaAnesthesia);
                break;
        }
    }

}
